<include file="Common/header" />
<script type="text/javascript" src="__PUBLIC__/uploadify/jquery.uploadify.min.js"></script>
<link rel="stylesheet" href="__PUBLIC__/uploadify/uploadify.css" >
<div class="container">
    <div class="row">

        <div class="col-md-2">
            <include file="Common/left_siber" />
        </div>
        <div class="col-md-10" >
            <form action="{:U('Article/addhandler')}" method="post">
            <script type="text/javascript"   src="__PUBLIC__/ueditor/ueditor.config.js"></script>
            <script type="text/javascript"    src="__PUBLIC__/ueditor/ueditor.all.js"></script>
            <script type="text/javascript"    src="__PUBLIC__/ueditor/lang/zh-cn/zh-cn.js"></script>
            <script type="text/javascript"    src="__PUBLIC__/ueditor/NUIedit.js"></script>
             <div class="row">

                 <div class="page-header"><h3>{$page_title}</h3></div>
                    <div class="col-md-8" style="padding: 0;">

                                <div class="btn-group  role="group" aria-label="" style="margin-bottom:10px;" >
                                    <a  class="btn btn-default <if condition="CONTROLLER_NAME eq 'Article' && ACTION_NAME eq 'index'">active</if>" href="{:U('Article/index')}">يازمىلار</a>&nbsp;
                                    <a  class="btn btn-default <if condition="CONTROLLER_NAME eq 'Article' && ACTION_NAME eq 'add'">active</if>" href="{:U('Article/add')}" style="margin-bottom:10px;">يازما قۇشۇش</a>
                                 </div>

                                <div class="form-group">
                                    <input type="text" class="form-control"  placeholder="يازما نامى" name="title">
                                </div>
                                <div class="form-group">
                                    <select class="form-control" name="category_cid">
                                        <option value="0">   كاتىگورىيە تاللاڭ</option>
                                         <foreach  name="categorys" item="c">
      <option value="{$c['id']}"><if condition="$c['pid'] neq 0"><?php echo str_repeat('&nbsp',$c['level']*8); ?></if>{$c['cname']}</option>

                                         </foreach>

                                    </select>
                                </div>
                                <div class="form-group" >
                                    <textarea class="form-control" name="description" rows="6"  placeholder="قىسقىچە مەزمۇنى "></textarea>
                                </div>

                                <div class="form-group" >
                                    <textarea name="content" id="editor"  style="height:400px;width: 100%;" placeholder="مەزمۇن"></textarea>
                                    <script>
                                        var ue = UE.getEditor('editor');
                                    </script>
                                </div>

                                <div class="form-group">
                                    <input type="text" class="form-control"  placeholder="تەرتىپ" name="sort">
                                </div>
                                <div class="form-group">
                                    <input type="text" class="form-control"  placeholder="يازما ئاپتۇرى" name="author">
                                </div>
                                <div class="radio">
                                    <label class="radio-inline">
                                        <input type="radio" name="status" id="inlineRadio1" value="1" checked> ئۇچۇق
                                    </label>
                                    <label class="radio-inline">
                                        <input type="radio" name="status" id="inlineRadio2" value="0"> تاقاق
                                    </label>
                                </div>
                                <button type="submit" class="btn btn-primary">قۇشۇش</button>

                    </div>
                    <div class="col-md-4">
                        <div class="panel panel-default">
                            <div class="panel-heading">يازما رەسىمى</div>
                            <div class="panel-body">
                                <span value="time()" name="add_time"></span>
                               <input type="text" class="form-control" id="thumb" name="thumb">
                                <input id="file" type="file" multiple="false">
                                <br>
                                <img src="" alt="" id="thumber" >
                                <script type="text/javascript">
                                    $(function() {
                                        $('#file').uploadify({
                                            'formData'     : {
                                                '<?php echo session_name();?>' : '<?php echo session_id();?>',
                                            },
                                            'fileTypeDesc' : '上传文件',//上传描述
                                            'fileTypeExts' : '*.jpg;*.png',
                                            'swf' : '__PUBLIC__/uploadify/uploadify.swf',
                                            'uploader' : "{:U('Article/uploadThumb')}",
                                            'buttonText':'选择文件',
                                            'fileSizeLimit' : '2000KB',
                                            'uploadLimit' : 1,//上传文件数
                                            'width':65,
                                            'height':25,
                                            'successTimeout':10,//等待服务器响应时间
                                            'removeTimeout' : 0.2,//成功显示时间
                                            'onUploadSuccess' : function(file, data, response) {
                                                //转为json
                                                data=$.parseJSON(data);
                                                $('#thumb').val(data);
                                                $('#thumber').attr('src','/'+data);
                                                //获得图片地址
                                                //console.log(data);
                                                /*var imageUrl = data.url;
                                                var li="<li path='"+data.path+"' url='"+data.url+"'><img src='"+imageUrl+"'/><input type='hidden' name='thumb' value='"+data.path+"'/></li>";
                                                $("#uploadList ul").prepend(li);*/
                                            }
                                        });
                                    });
                                </script>
                                <div id="uploadList">
                                    <ul>

                                    </ul>
                                </div>
                            </div>
                        </div>

                        <div class="panel panel-default">
                            <div class="panel-heading">
                                <h3 class="panel-title">خەتكۈچلەر</h3>
                            </div>
                            <div class="panel-body">
                                <foreach name="tags" item="t">
                                    <label class="checkbox-inline">  <input type="checkbox"  value="{$t['tid']}" name="tag[]"> {$t['tname']} </label>
                                </foreach>

                            </div>
                        </div>
                    </div>
             </div>
        </form>
        </div>

    </div>
</div>
<include file="Common/footer" />